package com.lczyfz.campusinfo.modules.jobmesmanage.web;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.lczyfz.campusinfo.common.web.BaseController;
import com.lczyfz.campusinfo.modules.jobmesmanage.entity.JobMes;
import com.lczyfz.campusinfo.modules.jobmesmanage.service.JobMesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@Controller
public class JobMesNameController extends BaseController{
    @Autowired
    private JobMesService jobMesService;
    @ResponseBody
    @RequestMapping(value = "/Job/mes/type", method = RequestMethod.POST)
    public List<Map<String, Object>> allType(HttpServletRequest request, HttpServletResponse response) {
        List<Map<String, Object>> mapList = Lists.newArrayList();
        JobMes jobMes = new JobMes();
        List<JobMes> list = jobMesService.findList(jobMes);
        for (int i = 0; i < list.size(); i++) {
            JobMes e = list.get(i);
            Map<String, Object> map = Maps.newHashMap();
            map.put("id", e.getId());
            map.put("name", e.getJobStype());
            mapList.add(map);
        }
        return mapList;
    }

}
